import { getToken } from '@/utils/auth'
const defaultSettings = require('../../settings.js')
export default (_self) => {
  return {
    editBtn: true,
    editBtnText: '修改文件',
    delBtn: true,
    addBtn: true,
    labelWidth: 140,
    index: true,
    indexLabel: '序号',
    align: 'center',
    headerAlign: 'center',
    border: true,
    dialogWidth: '50%',
    stripe: false,
    size: 'mini',
    excelBtn: true,
    // selection: true,
    searchMenuSpan: 4,
    props: {
      label: 'label',
      value: 'value'
    },
    column: [
      {
        width: 160,
        sortable: true,
        label: '添加时间',
        prop: 'add_time',
        span: 12,
        display: false,
        type: 'datetime'
      },

      {
        label: '文件名',
        prop: 'name',
        value: '',
        addDisplay: false,
        hide:true,
        span: 12
      },
      {
        label: '文件',
        prop: 'fileinfo',
        minwidth: 400,
        display: false,
        span: 12
      },

      {
        data: {
          key: getToken()
        },
        showColumn: false,
        width: 120,
        accept: 'application/msexcel,application/msword,application/pdf,image/jpeg,image/png,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document',
        label: '上传文件',
        prop: 'url',
        hide: true,
        type: 'upload',
        limit: 1,
        dataType: 'string',
        loadText: '附件上传中，请稍等',
        span: 24,
        tip: '只能上传pdf/doc/docx/xlsx/png/jpg/jpeg/gif/mp4文件',
        propsHttp: {
          res: 'datas',
          name: ''
        },
        action: defaultSettings.uploadFile
      },
      {
        label: '文件大小',
        hide: true,
        prop: 'size',
        display: false,
        value: '',
        span: 12
      },

      {
        label: '排序',
        hide: true,
        prop: 'sort',
        display: false,
        span: 12,
        type: 'number',
        sortable: true
      },
      {
        width: 160,
        sortable: true,
        label: '修改时间',
        prop: 'update_time',
        hide: true,
        span: 12,
        type: 'datetime',
        display: false
      },

      {
        span: 12,
        width:80,
        label: '是否启用',
        prop: 'state',
        search: true,
        searchSpan: 4,
        type: 'select',
        slot: true,
        value: 1,
        dicData: [{
          label: '启用',
          value: 1
        }, {
          label: '禁用',
          value: 2
        }],
        rules: [{
          required: true,
          message: '请选择状态',
          trigger: 'change'
        }]
      }
    ]
  }
}
